#include <iostream>
#include <vector>
#include <cstdio> 
#include <algorithm>
#include <cstring>
#include <queue>

#define in read()
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int >  vec;
typedef pair < int , int > pii;
typedef vector < pii > veg;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2e5 + 10;
const int inf = 0x3f3f3f3f;

int n,Q,dep[N],siz[N],fa[19][N],K,m,v[N],s[N],col[N],u[N],tim,stk[N],dfn[N],top,dis[N];
vec G[N],pot;
veg E[N];
bool vis[N];

void link(int x,int y) { if(dep[x] > dep[y]) swap(x,y); E[x].pb({y,dep[y] - dep[x]}); E[y].pb({x,dep[y] - dep[x]}); }

void dfs(int x,int p) {
    dfn[x] = ++tim; fa[0][x] = p; dep[x] = dep[p] + 1; for(int i = 1;i < 18;i++) fa[i][x] = fa[i - 1][fa[i - 1][x]];
    for(auto y : G[x]) if(y ^ p) dfs(y,x);
}

int lca(int x,int y) {
    if(dep[x] < dep[y]) swap(x,y);
    for(int i = 17;i >= 0;i--) if(dep[fa[i][x]] >= dep[y]) x = fa[i][x];
    if(x == y) return x;
    for(int i = 17;i >= 0;i--) if(fa[i][x] != fa[i][y]) x = fa[i][x],y = fa[i][y];
    return fa[0][x];
}

struct node { int dist,col,x; };
bool operator < (node a,node b) { return (a.dist + s[a.col] - 1) / s[a.col] ^ (b.dist + s[b.col] - 1) / s[b.col] ? (a.dist + s[a.col] - 1) / s[a.col] > (b.dist + s[b.col] - 1) / s[b.col] : a.col > b.col; }

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    n = in; for(int i = 1,u,v;i < n;i++) u = in,v = in,G[u].pb(v),G[v].pb(u);
    dfs(1,0); Q = in; memset(dis,0x3f,sizeof dis);
    while(Q--) {
	K = in,m = in; vec().swap(pot);
	for(int i = 1;i <= K;i++) v[i] = in,s[i] = in,pot.pb(v[i]);
	for(int i = 1;i <= m;i++) u[i] = in,pot.pb(u[i]);
	sort(pot.begin(),pot.end(),[](int x,int y) { return dfn[x] < dfn[y]; }); pot.resize(unique(pot.begin(),pot.end()) - pot.begin());
	top = 0; stk[++top] = 1; vec al(1,1);
	for(auto x : pot) {
	    if(x == 1) continue; al.pb(x);
	    int L = lca(stk[top],x); al.pb(L);
	    if(L != stk[top]) {
		while(top > 1 && dep[L] <= dep[stk[top - 1]]) link(stk[top - 1],stk[top]),top--;
		if(L != stk[top]) link(stk[top],L),stk[top] = L; 
	    } stk[++top] = x;
	}
	for(int i = 1;i < top;i++) link(stk[i],stk[i + 1]);
	priority_queue < node > q;
	for(int i = 1;i <= K;i++) q.push((node) { 0,i,v[i] });
	while(!q.empty()) {
	    node p = q.top(); int x = p.x; q.pop(); if(vis[x]) continue;
	    col[x] = p.col; vis[x] = true; dis[x] = p.dist;
	    for(auto d : E[x]) {
		int y = d.fi,w = d.se;
		q.push((node) { dis[x] + w,p.col,y });
	    }
	}
	for(int i = 1;i <= m;i++) printf("%d ",col[u[i]]); puts("");
	for(auto i : al) col[i] = 0,dis[i] = inf,veg().swap(E[i]),vis[i] = false;
    }
} 
